package com.example.ecommercedemo.utils;

import com.github.pagehelper.PageInfo;

public class PageUtils {//功能：把pageHelper帮我们分页的数据信息封装到pageResult
    public static PageResult getPageResult(PageInfo<?> pageInfo) {
        PageResult pageResult = new PageResult();
        pageResult.setPageNum(pageInfo.getPageNum());
        pageResult.setPageSize(pageInfo.getPageSize());
        pageResult.setTotalpage(pageInfo.getPages());
        pageResult.setTotalsize(pageInfo.getTotal());
        pageResult.setRows(pageInfo.getList());
        return pageResult;
    }
}
